// pages/personal/personal.js

const config = require('../../config/api.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userName: '',
    avataUrl: '',
    point: '',
    status:'',
    money:''
  },

  onLoad: function(options) {
  },

  integral: function() {
    wx.request({
      url: config.userInfo,
      method: 'POST',
      header: {
        'Authorization': 'Bearer ' + wx.getStorageSync('token')
      },
      success: (res) => {
        // console.log(res)
        this.setData({
          point: res.data.point,
          status: res.data.status,
          money:res.data.money
        })
      }
    })
  },
  
 
  onShow: function() {
    let that = this;
    wx.getUserInfo({
      success(res) {
        // console.log(res)
        that.setData({
          userName: res.userInfo.nickName,
          avataUrl: res.userInfo.avatarUrl
        });
      }
    })
    this.integral()
  },

  call(){
    wx.makePhoneCall({
      phoneNumber: '17826062772',
    })
  }
})